ocamldep *.mli *.ml > .depend ocamlc -annot -c showball.mli ocamlc -annot -c -I ../../lib showball.ml ocamlrun ../../bin/zlc.byte -I ../../lib showball.lsi ocamlrun ../../bin/zlc.byte -I ../../lib -s main -period -v -sampling 200 ball.ls ---------------------------------------------------------------------------- Parsing done. See below: ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- Scoping done. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let hybrid ball(y_0_2) = (* defs: init der y_3: ERROR, init der(last)(cur) y_v_4: ERROR, mem(cur) z_5: ERROR *) let rec der y_3 = y_v_4 init y_0_2 and der y_v_4 = (~-.)(g) init 0.000000 reset | (z_5) -> ( *. )((~-.)(loose), last y_v_4) and z_5 = up (~-.)(y_3) in (y_3, y_v_4, z_5) let node showtime(()) = (* defs: mem(cur) t_6: ERROR *) let rec t_6 = (+.)(0.000000 fby t_6, 0.010000) in Showball.showtime(t_6) let hybrid main(()) = (* defs: mem(cur) y_7: ERROR, mem(cur) y_v_8: ERROR, mem(cur) z_9: ERROR *) let rec (y_7, y_v_8, z_9) = ball(y_0) in (* defs: val result_11: ERROR *) let rec present | (z_9) -> do emit result_11 = Showball.show(y_7, y_v_8) done in result_11; (* defs: val result_10: ERROR *) let rec present | (period (0.010000)) -> do emit result_10 = showtime(()) done in result_10;() ---------------------------------------------------------------------------- Typing done. ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let hybrid ball(y_0_2) = (* defs: init der y_3: float, init der(last)(cur) y_v_4: float, mem(cur) z_5: zero *) let rec der y_3 = y_v_4 init y_0_2 and der y_v_4 = (~-.)(g) init 0.000000 reset | (z_5) -> ( *. )((~-.)(loose), last y_v_4) and z_5 = up (~-.)(y_3) in (y_3, y_v_4, z_5) let node showtime(()) = (* defs: mem(cur) t_6: float *) let rec t_6 = (+.)(0.000000 fby t_6, 0.010000) in Showball.showtime(t_6) let hybrid main(()) = (* defs: mem(cur) y_7: float, mem(cur) y_v_8: float, mem(cur) z_9: zero *) let rec (y_7, y_v_8, z_9) = ball(y_0) in (* defs: val result_11: unit signal *) let rec present | (z_9) -> (* dv = {result_11} *) do emit result_11 = Showball.show(y_7, y_v_8) done in result_11; (* defs: val result_10: unit signal *) let rec present | (period (0.010000)) -> (* dv = {result_10} *) do emit result_10 = showtime(()) done in result_10;() ---------------------------------------------------------------------------- Causality check done ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- Initialization check done ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- Translation of automata done. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let hybrid ball(y_0_2) = (* defs: init der y_3: float, init der(last)(cur) y_v_4: float, mem(cur) z_5: zero *) let rec z_5 = up (~-.)(y_3) and der y_v_4 = (~-.)(g) init 0.000000 reset | (z_5) -> ( *. )((~-.)(loose), last y_v_4) and der y_3 = y_v_4 init y_0_2 in (y_3, y_v_4, z_5) let node showtime(()) = (* defs: mem(cur) t_6: float *) let rec t_6 = (+.)(0.000000 fby t_6, 0.010000) in Showball.showtime(t_6) let hybrid main(()) = (* defs: mem(cur) y_7: float, mem(cur) y_v_8: float, mem(cur) z_9: zero *) let rec (y_7, y_v_8, z_9) = ball(y_0) in (* defs: val result_11: unit signal *) let rec present | (z_9) -> (* dv = {result_11} *) do emit result_11 = Showball.show(y_7, y_v_8) done in result_11; (* defs: val result_10: unit signal *) let rec present | (period (0.010000)) -> (* dv = {result_10} *) do emit result_10 = showtime(()) done in result_10;() ---------------------------------------------------------------------------- Translation of activations done. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let hybrid ball(y_0_2) = (* defs: init der y_3: float, init der(last)(cur) y_v_4: float, mem(cur) z_5: zero *) let rec init y_3 = y_0_2 and der y_3 = y_v_4 and init y_v_4 = 0.000000 and der y_v_4 = (~-.)(g) and present | (z_5) -> (* dv = {y_v_4} *) do y_v_4 = ( *. )((~-.)(loose), last y_v_4) done and z_5 = up (~-.)(y_3) in (y_3, y_v_4, z_5) let node showtime(()) = (* defs: mem(cur) t_6: float *) let rec t_6 = (+.)(0.000000 fby t_6, 0.010000) in Showball.showtime(t_6) let hybrid main(()) = (* defs: mem(cur) y_7: float, mem(cur) y_v_8: float, mem(cur) z_9: zero *) let rec (y_7, y_v_8, z_9) = ball(y_0) in (* defs: val result_11: unit signal *) let rec present | (z_9) -> (* dv = {result_11} *) do emit result_11 = Showball.show(y_7, y_v_8) done in result_11; (* defs: val result_10: unit signal *) let rec present | (period (0.010000)) -> (* dv = {result_10} *) do emit result_10 = showtime(()) done in result_10;() ---------------------------------------------------------------------------- Inlining of function calls. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let hybrid ball(y_0_2) = (* defs: init der y_12: float, init der(last)(cur) y_v_13: float, mem(cur) z_14: zero *) let rec init y_12 = y_0_2 and der y_12 = y_v_13 and init y_v_13 = 0.000000 and der y_v_13 = (~-.)(g) and present | (z_14) -> (* dv = {y_v_13} *) do y_v_13 = ( *. )((~-.)(loose), last y_v_13) done and z_14 = up (~-.)(y_12) in (y_12, y_v_13, z_14) let node showtime(()) = (* defs: mem(cur) t_15: float *) let rec t_15 = (+.)(0.000000 fby t_15, 0.010000) in Showball.showtime(t_15) let hybrid main(()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero *) let rec (y_16, y_v_17, z_18) = ball(y_0) in (* defs: val result_20: unit signal *) let rec present | (z_18) -> (* dv = {result_20} *) do emit result_20 = Showball.show(y_16, y_v_17) done in result_20; (* defs: val result_19: unit signal *) let rec present | (period (0.010000)) -> (* dv = {result_19} *) do emit result_19 = showtime(()) done in result_19;() ---------------------------------------------------------------------------- Flattening lets and naming of stateful applications done. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let hybrid ball(y_0_2) = (* defs: init der y_12: float, init der(last)(cur) y_v_13: float, mem(cur) z_14: zero *) let rec init y_12 = y_0_2 and der y_12 = y_v_13 and init y_v_13 = 0.000000 and der y_v_13 = (~-.)(g) and present | (z_14) -> (* dv = {y_v_13} *) do y_v_13 = ( *. )((~-.)(loose), last y_v_13) done and z_14 = up (~-.)(y_12) in (y_12, y_v_13, z_14) let node showtime(()) = (* defs: mem(cur) t_15: float *) let rec t_15 = (+.)(0.000000 fby t_15, 0.010000) in Showball.showtime(t_15) let hybrid main(()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_19: unit signal, val result_20: unit signal, val result_22: zero *) let rec (y_16, y_v_17, z_18) = ball(y_0) and present | (z_18) -> local result_21 in (* dv = {result_20} *) (* defs: val result_21: unit *) do result_21 = Showball.show(y_16, y_v_17) and emit result_20 = result_21 done and result_22 = period (0.010000) and present | (result_22) -> local result_23 in (* dv = {result_19} *) (* defs: val result_23: unit *) do result_23 = showtime(()) and emit result_19 = result_23 done in result_20;result_19;() ---------------------------------------------------------------------------- Translation of periods done. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let hybrid ball(time_24, y_0_2) = (* defs: init der y_12: float, init der(last)(cur) y_v_13: float, mem(cur) z_14: zero *) let rec z_14 = up (~-.)(y_12) and present | (z_14) -> (* dv = {y_v_13} *) do y_v_13 = ( *. )((~-.)(loose), last y_v_13) done and der y_v_13 = (~-.)(g) and init y_v_13 = 0.000000 and der y_12 = y_v_13 and init y_12 = y_0_2 in ((y_12, y_v_13, z_14), infinity) let node showtime(()) = (* defs: mem(cur) t_15: float *) let rec t_15 = (+.)(0.000000 fby t_15, 0.010000) in Showball.showtime(t_15) let hybrid main(time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_19: unit signal, val result_20: unit signal, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float *) let rec present | (result_22) -> local result_23 in (* dv = {result_19} *) (* defs: val result_23: unit *) do result_23 = showtime(()) and emit result_19 = result_23 done and result_22 = false -> p_28 and present | (p_28) -> local p_27 in (* defs: val p_27: float *) do p_27 = 0.010000 fby p_27 and next_t_29 = (+.)(time_25 -> last next_t_29, p_27) done and init next_t_29 = 0.000000 and p_28 = Zlsolve.time_geq(time_25, last next_t_29) and present | (z_18) -> local result_21 in (* dv = {result_20} *) (* defs: val result_21: unit *) do result_21 = Showball.show(y_16, y_v_17) and emit result_20 = result_21 done and ((y_16, y_v_17, z_18), time_26) = ball(time_25, y_0) in (result_20;result_19;(), min(time_26, next_t_29)) ---------------------------------------------------------------------------- Add goagains for weak transitions. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let hybrid ball(time_24, y_0_2) = (* defs: init der y_12: float, init der(last)(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false *) let rec init y_12 = y_0_2 and der y_12 = y_v_13 and init y_v_13 = 0.000000 and der y_v_13 = (~-.)(g) and present | (z_14) -> (* dv = {y_v_13} *) do goagain_30 = true and y_v_13 = ( *. )((~-.)(loose), last y_v_13) done and z_14 = up (~-.)(y_12) in (goagain_30, ((y_12, y_v_13, z_14), infinity)) let node showtime(()) = (* defs: mem(cur) t_15: float *) let rec t_15 = (+.)(0.000000 fby t_15, 0.010000) in Showball.showtime(t_15) let hybrid main(time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_19: unit signal, val result_20: unit signal, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false *) let rec (goagain_34, ((y_16, y_v_17, z_18), time_26)) = ball(time_25, y_0) and present | (z_18) -> local result_21 in (* dv = {result_20} *) (* defs: val result_21: unit *) do goagain_33 = true and result_21 = Showball.show(y_16, y_v_17) and emit result_20 = result_21 done and p_28 = Zlsolve.time_geq(time_25, last next_t_29) and init next_t_29 = 0.000000 and present | (p_28) -> local p_27 in (* defs: val p_27: float *) do goagain_32 = true and p_27 = 0.010000 fby p_27 and next_t_29 = (+.)(time_25 -> last next_t_29, p_27) done and result_22 = false -> p_28 and present | (result_22) -> local result_23 in (* dv = {result_19} *) (* defs: val result_23: unit *) do goagain_31 = true and result_23 = showtime(()) and emit result_19 = result_23 done in ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), min(time_26, next_t_29))) ---------------------------------------------------------------------------- Translation of present done. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let hybrid ball(time_24, y_0_2) = (* defs: init der y_12: float, init der(last)(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false *) let rec z_14 = up (~-.)(y_12) and match z_14 with | true -> do y_v_13 = ( *. )((~-.)(loose), last y_v_13) and goagain_30 = true done and der y_v_13 = (~-.)(g) and init y_v_13 = 0.000000 and der y_12 = y_v_13 and init y_12 = y_0_2 in (goagain_30, ((y_12, y_v_13, z_14), infinity)) let node showtime(()) = (* defs: mem(cur) t_15: float *) let rec t_15 = (+.)(0.000000 fby t_15, 0.010000) in Showball.showtime(t_15) let hybrid main(time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false *) let rec result_20 = (xv_37, xp_38) and result_19 = (xv_35, xp_36) and match result_22 with | true -> local result_23 in (* defs: val result_23: unit *) do xv_35 = result_23 and xp_36 = true and result_23 = showtime(()) and goagain_31 = true done and result_22 = false -> p_28 and match p_28 with | true -> local p_27 in (* defs: val p_27: float *) do next_t_29 = (+.)(time_25 -> last next_t_29, p_27) and p_27 = 0.010000 fby p_27 and goagain_32 = true done and init next_t_29 = 0.000000 and p_28 = Zlsolve.time_geq(time_25, last next_t_29) and match z_18 with | true -> local result_21 in (* defs: val result_21: unit *) do xv_37 = result_21 and xp_38 = true and result_21 = Showball.show(y_16, y_v_17) and goagain_33 = true done and (goagain_34, ((y_16, y_v_17, z_18), time_26)) = ball(time_25, y_0) in ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), min(time_26, next_t_29))) ---------------------------------------------------------------------------- Actualize write variables in blocks. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let hybrid ball(time_24, y_0_2) = (* defs: init der y_12: float, init der(last)(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false *) let rec z_14 = up (~-.)(y_12) and match z_14 with | true -> (* dv = {y_v_13, goagain_30} *) do y_v_13 = ( *. )((~-.)(loose), last y_v_13) and goagain_30 = true done and der y_v_13 = (~-.)(g) and init y_v_13 = 0.000000 and der y_12 = y_v_13 and init y_12 = y_0_2 in (goagain_30, ((y_12, y_v_13, z_14), infinity)) let node showtime(()) = (* defs: mem(cur) t_15: float *) let rec t_15 = (+.)(0.000000 fby t_15, 0.010000) in Showball.showtime(t_15) let hybrid main(time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false *) let rec result_20 = (xv_37, xp_38) and result_19 = (xv_35, xp_36) and match result_22 with | true -> local result_23 in (* dv = {goagain_31, xv_35, xp_36} *) (* defs: val result_23: unit *) do xv_35 = result_23 and xp_36 = true and result_23 = showtime(()) and goagain_31 = true done and result_22 = false -> p_28 and match p_28 with | true -> local p_27 in (* dv = {next_t_29, goagain_32} *) (* defs: val p_27: float *) do next_t_29 = (+.)(time_25 -> last next_t_29, p_27) and p_27 = 0.010000 fby p_27 and goagain_32 = true done and init next_t_29 = 0.000000 and p_28 = Zlsolve.time_geq(time_25, last next_t_29) and match z_18 with | true -> local result_21 in (* dv = {goagain_33, xv_37, xp_38} *) (* defs: val result_21: unit *) do xv_37 = result_21 and xp_38 = true and result_21 = Showball.show(y_16, y_v_17) and goagain_33 = true done and (goagain_34, ((y_16, y_v_17, z_18), time_26)) = ball(time_25, y_0) in ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), min(time_26, next_t_29))) ---------------------------------------------------------------------------- Completion and naming of shared variables done. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let hybrid ball(time_24, y_0_2) = (* defs: init der y_12: float, init der(last)(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false *) let rec init y_12 = y_0_2 and der y_12 = y_v_13 and init y_v_13 = 0.000000 and der y_v_13 = (~-.)(g) and total match z_14 with | true -> (* dv = {y_v_13, goagain_30} *) do goagain_30 = true and y_v_13 = ( *. )((~-.)(loose), last y_v_13) done | _ -> (* dv = {y_v_13} *) do y_v_13 = last y_v_13 done and z_14 = up (~-.)(y_12) in (goagain_30, ((y_12, y_v_13, z_14), infinity)) let node showtime(()) = (* defs: mem(cur) t_15: float *) let rec t_15 = (+.)(0.000000 fby t_15, 0.010000) in Showball.showtime(t_15) let hybrid main(time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false *) let rec (goagain_34, ((y_16, y_v_17, z_18), time_26)) = ball(time_25, y_0) and total match z_18 with | true -> local result_21 in (* dv = {goagain_33, xv_37, xp_38} *) (* defs: val result_21: unit *) do goagain_33 = true and result_21 = Showball.show(y_16, y_v_17) and xp_38 = true and xv_37 = result_21 done | _ -> do done and p_28 = Zlsolve.time_geq(time_25, last next_t_29) and init next_t_29 = 0.000000 and total match p_28 with | true -> local p_27 in (* dv = {next_t_29, goagain_32} *) (* defs: val p_27: float *) do goagain_32 = true and p_27 = 0.010000 fby p_27 and next_t_29 = (+.)(time_25 -> last next_t_29, p_27) done | _ -> (* dv = {next_t_29} *) do next_t_29 = last next_t_29 done and result_22 = false -> p_28 and total match result_22 with | true -> local result_23 in (* dv = {goagain_31, xv_35, xp_36} *) (* defs: val result_23: unit *) do goagain_31 = true and result_23 = showtime(()) and xp_36 = true and xv_35 = result_23 done | _ -> do done and result_19 = (xv_35, xp_36) and result_20 = (xv_37, xp_38) in ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), min(time_26, next_t_29))) ---------------------------------------------------------------------------- Removal of ODEs done. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let node ball(z_49, (iny_v_44, iny_39), d_1, time_24, y_0_2) = (* defs: mem(cur) y_12: float, mem(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false, val dy_41: float = 0.000000, mem(cur) lasty_42: float, val dy_v_46: float = 0.000000, mem(cur) lasty_v_47: float, val upz_50: float = 1.000000 *) let rec outy_v_45 = (if d_1 then y_v_13 else dy_v_46) and outy_40 = (if d_1 then y_12 else dy_41) and y_12 = lasty_42 and z_14 = z_49 and upz_50 = (~-.)(y_12) and total match z_14 with | true -> (* dv = {y_v_13, goagain_30} *) do y_v_13 = ( *. )((~-.)(loose), lasty_v_47) and goagain_30 = true done | _ -> (* dv = {y_v_13} *) do y_v_13 = lasty_v_47 done and dy_v_46 = (~-.)(g) and lasty_v_47 = 0.000000 -> (if d_1 then pre y_v_13 else iny_v_44) and dy_41 = y_v_13 and lasty_42 = y_0_2 -> (if d_1 then pre lasty_42 else iny_39) in (upz_50, (outy_v_45, outy_40), (goagain_30, ((y_12, y_v_13, z_14), infinity))) let node showtime(()) = (* defs: mem(cur) t_15: float *) let rec t_15 = (+.)(0.000000 fby t_15, 0.010000) in Showball.showtime(t_15) let node main(z_51, lx_53, d_1, time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false, val upz_52: float = 1.000000, val nx_54: float * float *) let rec result_20 = (xv_37, xp_38) and result_19 = (xv_35, xp_36) and total match result_22 with | true -> local result_23 in (* dv = {goagain_31, xv_35, xp_36} *) (* defs: val result_23: unit *) do xv_35 = result_23 and xp_36 = true and result_23 = showtime(()) and goagain_31 = true done | _ -> do done and result_22 = false -> p_28 and total match p_28 with | true -> local p_27 in (* dv = {next_t_29, goagain_32} *) (* defs: val p_27: float *) do next_t_29 = (+.)(time_25 -> last next_t_29, p_27) and p_27 = 0.010000 fby p_27 and goagain_32 = true done | _ -> (* dv = {next_t_29} *) do next_t_29 = last next_t_29 done and init next_t_29 = 0.000000 and p_28 = Zlsolve.time_geq(time_25, last next_t_29) and total match z_18 with | true -> local result_21 in (* dv = {goagain_33, xv_37, xp_38} *) (* defs: val result_21: unit *) do xv_37 = result_21 and xp_38 = true and result_21 = Showball.show(y_16, y_v_17) and goagain_33 = true done | _ -> do done and (upz_52, nx_54, (goagain_34, ((y_16, y_v_17, z_18), time_26))) = ball(z_51, lx_53, d_1, time_25, y_0) in (upz_52, nx_54, ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), min(time_26, next_t_29)))) ---------------------------------------------------------------------------- Compilation of reset done. Add initialization bit for every branch. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let node ball(z_49, (iny_v_44, iny_39), d_1, time_24, y_0_2) = (* defs: mem(cur) y_12: float, mem(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false, val dy_41: float = 0.000000, mem(cur) lasty_42: float, val dy_v_46: float = 0.000000, mem(cur) lasty_v_47: float, val upz_50: float = 1.000000 *) let rec lasty_42 = y_0_2 -> (if d_1 then pre lasty_42 else iny_39) and dy_41 = y_v_13 and lasty_v_47 = 0.000000 -> (if d_1 then pre y_v_13 else iny_v_44) and dy_v_46 = (~-.)(g) and total match z_14 with | true -> (* dv = {y_v_13, goagain_30} *) do goagain_30 = true and y_v_13 = ( *. )((~-.)(loose), lasty_v_47) done | _ -> (* dv = {y_v_13} *) do y_v_13 = lasty_v_47 done and upz_50 = (~-.)(y_12) and z_14 = z_49 and y_12 = lasty_42 and outy_40 = (if d_1 then y_12 else dy_41) and outy_v_45 = (if d_1 then y_v_13 else dy_v_46) in (upz_50, (outy_v_45, outy_40), (goagain_30, ((y_12, y_v_13, z_14), infinity))) let node showtime(()) = (* defs: mem(cur) t_15: float *) let rec t_15 = (+.)(0.000000 fby t_15, 0.010000) in Showball.showtime(t_15) let node main(z_51, lx_53, d_1, time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false, val upz_52: float = 1.000000, val nx_54: float * float *) let rec (upz_52, nx_54, (goagain_34, ((y_16, y_v_17, z_18), time_26))) = ball(z_51, lx_53, d_1, time_25, y_0) and total match z_18 with | true -> local result_21 in (* dv = {goagain_33, xv_37, xp_38} *) (* defs: val result_21: unit *) do goagain_33 = true and result_21 = Showball.show(y_16, y_v_17) and xp_38 = true and xv_37 = result_21 done | _ -> do done and p_28 = Zlsolve.time_geq(time_25, last next_t_29) and init next_t_29 = 0.000000 and total match p_28 with | true -> local p_27 in (* dv = {next_t_29, goagain_32} *) (* defs: val p_27: float *) do goagain_32 = true and p_27 = 0.010000 fby p_27 and next_t_29 = (+.)(time_25 -> last next_t_29, p_27) done | _ -> (* dv = {next_t_29} *) do next_t_29 = last next_t_29 done and result_22 = false -> p_28 and total match result_22 with | true -> local result_23 in (* dv = {goagain_31, xv_35, xp_36} *) (* defs: val result_23: unit *) do goagain_31 = true and result_23 = showtime(()) and xp_36 = true and xv_35 = result_23 done | _ -> do done and result_19 = (xv_35, xp_36) and result_20 = (xv_37, xp_38) in (upz_52, nx_54, ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), min(time_26, next_t_29)))) ---------------------------------------------------------------------------- Flattening lets and naming of stateful applications done. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let node ball(z_49, (iny_v_44, iny_39), d_1, time_24, y_0_2) = (* defs: mem(cur) y_12: float, mem(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false, val dy_41: float = 0.000000, mem(cur) lasty_42: float, val dy_v_46: float = 0.000000, mem(cur) lasty_v_47: float, val upz_50: float = 1.000000, val result_55: float, val result_56: float *) let rec result_56 = pre lasty_42 and lasty_42 = y_0_2 -> (if d_1 then result_56 else iny_39) and dy_41 = y_v_13 and result_55 = pre y_v_13 and lasty_v_47 = 0.000000 -> (if d_1 then result_55 else iny_v_44) and dy_v_46 = (~-.)(g) and total match z_14 with | true -> (* dv = {y_v_13, goagain_30} *) do goagain_30 = true and y_v_13 = ( *. )((~-.)(loose), lasty_v_47) done | _ -> (* dv = {y_v_13} *) do y_v_13 = lasty_v_47 done and upz_50 = (~-.)(y_12) and z_14 = z_49 and y_12 = lasty_42 and outy_40 = (if d_1 then y_12 else dy_41) and outy_v_45 = (if d_1 then y_v_13 else dy_v_46) in (upz_50, (outy_v_45, outy_40), (goagain_30, ((y_12, y_v_13, z_14), infinity))) let node showtime(()) = (* defs: mem(cur) t_15: float, val result_57: unit, val result_58: float *) let rec result_58 = 0.000000 fby t_15 and t_15 = (+.)(result_58, 0.010000) and result_57 = Showball.showtime(t_15) in result_57 let node main(z_51, lx_53, d_1, time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false, val upz_52: float = 1.000000, val nx_54: float * float, val result_59: float *) let rec (upz_52, nx_54, (goagain_34, ((y_16, y_v_17, z_18), time_26))) = ball(z_51, lx_53, d_1, time_25, y_0) and total match z_18 with | true -> local result_21 in (* dv = {goagain_33, xv_37, xp_38} *) (* defs: val result_21: unit *) do goagain_33 = true and result_21 = Showball.show(y_16, y_v_17) and xp_38 = true and xv_37 = result_21 done | _ -> do done and p_28 = Zlsolve.time_geq(time_25, last next_t_29) and init next_t_29 = 0.000000 and total match p_28 with | true -> local result_60, p_27 in (* dv = {next_t_29, goagain_32} *) (* defs: val p_27: float, val result_60: float *) do goagain_32 = true and p_27 = 0.010000 fby p_27 and result_60 = time_25 -> last next_t_29 and next_t_29 = (+.)(result_60, p_27) done | _ -> (* dv = {next_t_29} *) do next_t_29 = last next_t_29 done and result_22 = false -> p_28 and total match result_22 with | true -> local result_23 in (* dv = {goagain_31, xv_35, xp_36} *) (* defs: val result_23: unit *) do goagain_31 = true and result_23 = showtime(()) and xp_36 = true and xv_35 = result_23 done | _ -> do done and result_19 = (xv_35, xp_36) and result_20 = (xv_37, xp_38) and result_59 = min(time_26, next_t_29) in (upz_52, nx_54, ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), result_59))) ---------------------------------------------------------------------------- Actualize write variables in blocks. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let node ball(z_49, (iny_v_44, iny_39), d_1, time_24, y_0_2) = (* defs: mem(cur) y_12: float, mem(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false, val dy_41: float = 0.000000, mem(cur) lasty_42: float, val dy_v_46: float = 0.000000, mem(cur) lasty_v_47: float, val upz_50: float = 1.000000, val result_55: float, val result_56: float *) let rec result_56 = pre lasty_42 and lasty_42 = y_0_2 -> (if d_1 then result_56 else iny_39) and dy_41 = y_v_13 and result_55 = pre y_v_13 and lasty_v_47 = 0.000000 -> (if d_1 then result_55 else iny_v_44) and dy_v_46 = (~-.)(g) and total match z_14 with | true -> (* dv = {y_v_13, goagain_30} *) do goagain_30 = true and y_v_13 = ( *. )((~-.)(loose), lasty_v_47) done | _ -> (* dv = {y_v_13} *) do y_v_13 = lasty_v_47 done and upz_50 = (~-.)(y_12) and z_14 = z_49 and y_12 = lasty_42 and outy_40 = (if d_1 then y_12 else dy_41) and outy_v_45 = (if d_1 then y_v_13 else dy_v_46) in (upz_50, (outy_v_45, outy_40), (goagain_30, ((y_12, y_v_13, z_14), infinity))) let node showtime(()) = (* defs: mem(cur) t_15: float, val result_57: unit, val result_58: float *) let rec result_58 = 0.000000 fby t_15 and t_15 = (+.)(result_58, 0.010000) and result_57 = Showball.showtime(t_15) in result_57 let node main(z_51, lx_53, d_1, time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false, val upz_52: float = 1.000000, val nx_54: float * float, val result_59: float *) let rec (upz_52, nx_54, (goagain_34, ((y_16, y_v_17, z_18), time_26))) = ball(z_51, lx_53, d_1, time_25, y_0) and total match z_18 with | true -> local result_21 in (* dv = {goagain_33, xv_37, xp_38} *) (* defs: val result_21: unit *) do goagain_33 = true and result_21 = Showball.show(y_16, y_v_17) and xp_38 = true and xv_37 = result_21 done | _ -> do done and p_28 = Zlsolve.time_geq(time_25, last next_t_29) and init next_t_29 = 0.000000 and total match p_28 with | true -> local result_60, p_27 in (* dv = {next_t_29, goagain_32} *) (* defs: val p_27: float, val result_60: float *) do goagain_32 = true and p_27 = 0.010000 fby p_27 and result_60 = time_25 -> last next_t_29 and next_t_29 = (+.)(result_60, p_27) done | _ -> (* dv = {next_t_29} *) do next_t_29 = last next_t_29 done and result_22 = false -> p_28 and total match result_22 with | true -> local result_23 in (* dv = {goagain_31, xv_35, xp_36} *) (* defs: val result_23: unit *) do goagain_31 = true and result_23 = showtime(()) and xp_36 = true and xv_35 = result_23 done | _ -> do done and result_19 = (xv_35, xp_36) and result_20 = (xv_37, xp_38) and result_59 = min(time_26, next_t_29) in (upz_52, nx_54, ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), result_59))) ---------------------------------------------------------------------------- Completion and naming of shared variables done. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let node ball(z_49, (iny_v_44, iny_39), d_1, time_24, y_0_2) = (* defs: mem(cur) y_12: float, mem(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false, val dy_41: float = 0.000000, mem(cur) lasty_42: float, val dy_v_46: float = 0.000000, mem(cur) lasty_v_47: float, val upz_50: float = 1.000000, val result_55: float, val result_56: float *) let rec outy_v_45 = (if d_1 then y_v_13 else dy_v_46) and outy_40 = (if d_1 then y_12 else dy_41) and y_12 = lasty_42 and z_14 = z_49 and upz_50 = (~-.)(y_12) and total match z_14 with | true -> (* dv = {y_v_13, goagain_30} *) do y_v_13 = ( *. )((~-.)(loose), lasty_v_47) and goagain_30 = true done | _ -> (* dv = {y_v_13} *) do y_v_13 = lasty_v_47 done and dy_v_46 = (~-.)(g) and lasty_v_47 = 0.000000 -> (if d_1 then result_55 else iny_v_44) and result_55 = pre y_v_13 and dy_41 = y_v_13 and lasty_42 = y_0_2 -> (if d_1 then result_56 else iny_39) and result_56 = pre lasty_42 in (upz_50, (outy_v_45, outy_40), (goagain_30, ((y_12, y_v_13, z_14), infinity))) let node showtime(()) = (* defs: mem(cur) t_15: float, val result_57: unit, val result_58: float *) let rec result_57 = Showball.showtime(t_15) and t_15 = (+.)(result_58, 0.010000) and result_58 = 0.000000 fby t_15 in result_57 let node main(z_51, lx_53, d_1, time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false, val upz_52: float = 1.000000, val nx_54: float * float, val result_59: float *) let rec result_59 = min(time_26, next_t_29) and result_20 = (xv_37, xp_38) and result_19 = (xv_35, xp_36) and total match result_22 with | true -> local result_23 in (* dv = {goagain_31, xv_35, xp_36} *) (* defs: val result_23: unit *) do xv_35 = result_23 and xp_36 = true and result_23 = showtime(()) and goagain_31 = true done | _ -> do done and result_22 = false -> p_28 and total match p_28 with | true -> local result_60, p_27 in (* dv = {next_t_29, goagain_32} *) (* defs: val p_27: float, val result_60: float *) do next_t_29 = (+.)(result_60, p_27) and result_60 = time_25 -> last next_t_29 and p_27 = 0.010000 fby p_27 and goagain_32 = true done | _ -> (* dv = {next_t_29} *) do next_t_29 = last next_t_29 done and init next_t_29 = 0.000000 and p_28 = Zlsolve.time_geq(time_25, last next_t_29) and total match z_18 with | true -> local result_21 in (* dv = {goagain_33, xv_37, xp_38} *) (* defs: val result_21: unit *) do xv_37 = result_21 and xp_38 = true and result_21 = Showball.show(y_16, y_v_17) and goagain_33 = true done | _ -> do done and (upz_52, nx_54, (goagain_34, ((y_16, y_v_17, z_18), time_26))) = ball(z_51, lx_53, d_1, time_25, y_0) in (upz_52, nx_54, ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), result_59))) ---------------------------------------------------------------------------- Compilation of memories (init/->/last/fby/pre). See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let node ball(z_49, (iny_v_44, iny_39), d_1, time_24, y_0_2) = (* defs: mem(cur) y_12: float, mem(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false, val dy_41: float = 0.000000, mem(cur) lasty_42: float, val dy_v_46: float = 0.000000, mem(cur) lasty_v_47: float, val upz_50: float = 1.000000, val result_55: float, val result_56: float, val init_61: bool *) let rec init_61 = true fby false and result_56 = pre lasty_42 and lasty_42 = (if init_61 then y_0_2 else (if d_1 then result_56 else iny_39)) and dy_41 = y_v_13 and result_55 = pre y_v_13 and lasty_v_47 = (if init_61 then 0.000000 else (if d_1 then result_55 else iny_v_44)) and dy_v_46 = (~-.)(g) and total match z_14 with | true -> (* dv = {y_v_13, goagain_30} *) do goagain_30 = true and y_v_13 = ( *. )((~-.)(loose), lasty_v_47) done | _ -> (* dv = {y_v_13} *) do y_v_13 = lasty_v_47 done and upz_50 = (~-.)(y_12) and z_14 = z_49 and y_12 = lasty_42 and outy_40 = (if d_1 then y_12 else dy_41) and outy_v_45 = (if d_1 then y_v_13 else dy_v_46) in (upz_50, (outy_v_45, outy_40), (goagain_30, ((y_12, y_v_13, z_14), infinity))) let node showtime(()) = (* defs: mem(cur) t_15: float, val result_57: unit, val result_58: float, val copy_65: float *) let rec result_58 = 0.000000 fby copy_65 and copy_65 = t_15 and t_15 = (+.)(result_58, 0.010000) and result_57 = Showball.showtime(t_15) in result_57 let node main(z_51, lx_53, d_1, time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false, val upz_52: float = 1.000000, val nx_54: float * float, val result_59: float, val last_66: float, val init_67: bool, val copy_73: float *) let rec init_67 = true fby false and (upz_52, nx_54, (goagain_34, ((y_16, y_v_17, z_18), time_26))) = ball(z_51, lx_53, d_1, time_25, y_0) and total match z_18 with | true -> local result_21 in (* dv = {goagain_33, xv_37, xp_38} *) (* defs: val result_21: unit *) do goagain_33 = true and result_21 = Showball.show(y_16, y_v_17) and xp_38 = true and xv_37 = result_21 done | _ -> do done and p_28 = Zlsolve.time_geq(time_25, last_66) and last_66 = (if init_67 then 0.000000 else copy_73) and copy_73 = pre next_t_29 and total match p_28 with | true -> local pre_71, init_70, result_60, p_27 in (* dv = {next_t_29, goagain_32} *) (* defs: val p_27: float, val result_60: float, val init_70: bool, val pre_71: float *) do init_70 = true fby false and goagain_32 = true and p_27 = (if init_70 then 0.010000 else pre_71) and pre_71 = pre p_27 and result_60 = (if init_70 then time_25 else last_66) and next_t_29 = (+.)(result_60, p_27) done | _ -> (* dv = {next_t_29} *) do next_t_29 = last_66 done and result_22 = (if init_67 then false else p_28) and total match result_22 with | true -> local result_23 in (* dv = {goagain_31, xv_35, xp_36} *) (* defs: val result_23: unit *) do goagain_31 = true and result_23 = showtime(()) and xp_36 = true and xv_35 = result_23 done | _ -> do done and result_19 = (xv_35, xp_36) and result_20 = (xv_37, xp_38) and result_59 = min(time_26, next_t_29) in (upz_52, nx_54, ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), result_59))) ---------------------------------------------------------------------------- Actualize write variables in blocks. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let node ball(z_49, (iny_v_44, iny_39), d_1, time_24, y_0_2) = (* defs: mem(cur) y_12: float, mem(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false, val dy_41: float = 0.000000, mem(cur) lasty_42: float, val dy_v_46: float = 0.000000, mem(cur) lasty_v_47: float, val upz_50: float = 1.000000, val result_55: float, val result_56: float, val init_61: bool *) let rec init_61 = true fby false and result_56 = pre lasty_42 and lasty_42 = (if init_61 then y_0_2 else (if d_1 then result_56 else iny_39)) and dy_41 = y_v_13 and result_55 = pre y_v_13 and lasty_v_47 = (if init_61 then 0.000000 else (if d_1 then result_55 else iny_v_44)) and dy_v_46 = (~-.)(g) and total match z_14 with | true -> (* dv = {y_v_13, goagain_30} *) do goagain_30 = true and y_v_13 = ( *. )((~-.)(loose), lasty_v_47) done | _ -> (* dv = {y_v_13} *) do y_v_13 = lasty_v_47 done and upz_50 = (~-.)(y_12) and z_14 = z_49 and y_12 = lasty_42 and outy_40 = (if d_1 then y_12 else dy_41) and outy_v_45 = (if d_1 then y_v_13 else dy_v_46) in (upz_50, (outy_v_45, outy_40), (goagain_30, ((y_12, y_v_13, z_14), infinity))) let node showtime(()) = (* defs: mem(cur) t_15: float, val result_57: unit, val result_58: float, val copy_65: float *) let rec result_58 = 0.000000 fby copy_65 and copy_65 = t_15 and t_15 = (+.)(result_58, 0.010000) and result_57 = Showball.showtime(t_15) in result_57 let node main(z_51, lx_53, d_1, time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false, val upz_52: float = 1.000000, val nx_54: float * float, val result_59: float, val last_66: float, val init_67: bool, val copy_73: float *) let rec init_67 = true fby false and (upz_52, nx_54, (goagain_34, ((y_16, y_v_17, z_18), time_26))) = ball(z_51, lx_53, d_1, time_25, y_0) and total match z_18 with | true -> local result_21 in (* dv = {goagain_33, xv_37, xp_38} *) (* defs: val result_21: unit *) do goagain_33 = true and result_21 = Showball.show(y_16, y_v_17) and xp_38 = true and xv_37 = result_21 done | _ -> do done and p_28 = Zlsolve.time_geq(time_25, last_66) and last_66 = (if init_67 then 0.000000 else copy_73) and copy_73 = pre next_t_29 and total match p_28 with | true -> local pre_71, init_70, result_60, p_27 in (* dv = {next_t_29, goagain_32} *) (* defs: val p_27: float, val result_60: float, val init_70: bool, val pre_71: float *) do init_70 = true fby false and goagain_32 = true and p_27 = (if init_70 then 0.010000 else pre_71) and pre_71 = pre p_27 and result_60 = (if init_70 then time_25 else last_66) and next_t_29 = (+.)(result_60, p_27) done | _ -> (* dv = {next_t_29} *) do next_t_29 = last_66 done and result_22 = (if init_67 then false else p_28) and total match result_22 with | true -> local result_23 in (* dv = {goagain_31, xv_35, xp_36} *) (* defs: val result_23: unit *) do goagain_31 = true and result_23 = showtime(()) and xp_36 = true and xv_35 = result_23 done | _ -> do done and result_19 = (xv_35, xp_36) and result_20 = (xv_37, xp_38) and result_59 = min(time_26, next_t_29) in (upz_52, nx_54, ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), result_59))) ---------------------------------------------------------------------------- Translation into A-normal form. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let node ball(z_49, (iny_v_44, iny_39), d_1, time_24, y_0_2) = (* defs: mem(cur) y_12: float, mem(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false, val dy_41: float = 0.000000, mem(cur) lasty_42: float, val dy_v_46: float = 0.000000, mem(cur) lasty_v_47: float, val upz_50: float = 1.000000, val result_55: float, val result_56: float, val init_61: bool *) let rec outy_v_45 = (if d_1 then y_v_13 else dy_v_46) and outy_40 = (if d_1 then y_12 else dy_41) and y_12 = lasty_42 and z_14 = z_49 and upz_50 = (~-.)(y_12) and total match z_14 with | true -> (* dv = {y_v_13, goagain_30} *) do y_v_13 = ( *. )((~-.)(loose), lasty_v_47) and goagain_30 = true done | _ -> (* dv = {y_v_13} *) do y_v_13 = lasty_v_47 done and dy_v_46 = (~-.)(g) and lasty_v_47 = (if init_61 then 0.000000 else (if d_1 then result_55 else iny_v_44)) and result_55 = pre y_v_13 and dy_41 = y_v_13 and lasty_42 = (if init_61 then y_0_2 else (if d_1 then result_56 else iny_39)) and result_56 = pre lasty_42 and init_61 = true fby false in (upz_50, (outy_v_45, outy_40), (goagain_30, ((y_12, y_v_13, z_14), infinity))) let node showtime(()) = (* defs: mem(cur) t_15: float, val result_57: unit, val result_58: float, val copy_65: float *) let rec result_57 = Showball.showtime(t_15) and t_15 = (+.)(result_58, 0.010000) and copy_65 = t_15 and result_58 = 0.000000 fby copy_65 in result_57 let node main(z_51, lx_53, d_1, time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false, val upz_52: float = 1.000000, val nx_54: float * float, val result_59: float, val last_66: float, val init_67: bool, val copy_73: float *) let rec result_59 = min(time_26, next_t_29) and result_20 = (xv_37, xp_38) and result_19 = (xv_35, xp_36) and total match result_22 with | true -> local result_23 in (* dv = {goagain_31, xv_35, xp_36} *) (* defs: val result_23: unit *) do xv_35 = result_23 and xp_36 = true and result_23 = showtime(()) and goagain_31 = true done | _ -> do done and result_22 = (if init_67 then false else p_28) and total match p_28 with | true -> local pre_71, init_70, result_60, p_27 in (* dv = {next_t_29, goagain_32} *) (* defs: val p_27: float, val result_60: float, val init_70: bool, val pre_71: float *) do next_t_29 = (+.)(result_60, p_27) and result_60 = (if init_70 then time_25 else last_66) and pre_71 = pre p_27 and p_27 = (if init_70 then 0.010000 else pre_71) and goagain_32 = true and init_70 = true fby false done | _ -> (* dv = {next_t_29} *) do next_t_29 = last_66 done and copy_73 = pre next_t_29 and last_66 = (if init_67 then 0.000000 else copy_73) and p_28 = Zlsolve.time_geq(time_25, last_66) and total match z_18 with | true -> local result_21 in (* dv = {goagain_33, xv_37, xp_38} *) (* defs: val result_21: unit *) do xv_37 = result_21 and xp_38 = true and result_21 = Showball.show(y_16, y_v_17) and goagain_33 = true done | _ -> do done and (upz_52, nx_54, (goagain_34, ((y_16, y_v_17, z_18), time_26))) = ball(z_51, lx_53, d_1, time_25, y_0) and init_67 = true fby false in (upz_52, nx_54, ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), result_59))) ---------------------------------------------------------------------------- Common sub-expression elimination for registers. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let node ball(z_49, (iny_v_44, iny_39), d_1, time_24, y_0_2) = (* defs: mem(cur) y_12: float, mem(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false, val dy_41: float = 0.000000, mem(cur) lasty_42: float, val dy_v_46: float = 0.000000, mem(cur) lasty_v_47: float, val upz_50: float = 1.000000, val result_55: float, val result_56: float, val init_61: bool *) let rec init_61 = true fby false and result_56 = pre lasty_42 and lasty_42 = (if init_61 then y_0_2 else (if d_1 then result_56 else iny_39)) and dy_41 = y_v_13 and result_55 = pre y_v_13 and lasty_v_47 = (if init_61 then 0.000000 else (if d_1 then result_55 else iny_v_44)) and dy_v_46 = (~-.)(g) and total match z_14 with | true -> (* dv = {y_v_13, goagain_30} *) do goagain_30 = true and y_v_13 = ( *. )((~-.)(loose), lasty_v_47) done | _ -> (* dv = {y_v_13} *) do y_v_13 = lasty_v_47 done and upz_50 = (~-.)(y_12) and z_14 = z_49 and y_12 = lasty_42 and outy_40 = (if d_1 then y_12 else dy_41) and outy_v_45 = (if d_1 then y_v_13 else dy_v_46) in (upz_50, (outy_v_45, outy_40), (goagain_30, ((y_12, y_v_13, z_14), infinity))) let node showtime(()) = (* defs: mem(cur) t_15: float, val result_57: unit, val result_58: float, val copy_65: float *) let rec result_58 = 0.000000 fby copy_65 and copy_65 = t_15 and t_15 = (+.)(result_58, 0.010000) and result_57 = Showball.showtime(t_15) in result_57 let node main(z_51, lx_53, d_1, time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false, val upz_52: float = 1.000000, val nx_54: float * float, val result_59: float, val last_66: float, val init_67: bool, val copy_73: float *) let rec init_67 = true fby false and (upz_52, nx_54, (goagain_34, ((y_16, y_v_17, z_18), time_26))) = ball(z_51, lx_53, d_1, time_25, y_0) and total match z_18 with | true -> local result_21 in (* dv = {goagain_33, xv_37, xp_38} *) (* defs: val result_21: unit *) do goagain_33 = true and result_21 = Showball.show(y_16, y_v_17) and xp_38 = true and xv_37 = result_21 done | _ -> do done and p_28 = Zlsolve.time_geq(time_25, last_66) and last_66 = (if init_67 then 0.000000 else copy_73) and copy_73 = pre next_t_29 and total match p_28 with | true -> local pre_71, init_70, result_60, p_27 in (* dv = {next_t_29, goagain_32} *) (* defs: val p_27: float, val result_60: float, val init_70: bool, val pre_71: float *) do init_70 = true fby false and goagain_32 = true and p_27 = (if init_70 then 0.010000 else pre_71) and pre_71 = pre p_27 and result_60 = (if init_70 then time_25 else last_66) and next_t_29 = (+.)(result_60, p_27) done | _ -> (* dv = {next_t_29} *) do next_t_29 = last_66 done and result_22 = (if init_67 then false else p_28) and total match result_22 with | true -> local result_23 in (* dv = {goagain_31, xv_35, xp_36} *) (* defs: val result_23: unit *) do goagain_31 = true and result_23 = showtime(()) and xp_36 = true and xv_35 = result_23 done | _ -> do done and result_19 = (xv_35, xp_36) and result_20 = (xv_37, xp_38) and result_59 = min(time_26, next_t_29) in (upz_52, nx_54, ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), result_59))) ---------------------------------------------------------------------------- Scheduling done. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let node ball(z_49, (iny_v_44, iny_39), d_1, time_24, y_0_2) = (* defs: mem(cur) y_12: float, mem(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false, val dy_41: float = 0.000000, mem(cur) lasty_42: float, val dy_v_46: float = 0.000000, mem(cur) lasty_v_47: float, val upz_50: float = 1.000000, val result_55: float, val result_56: float, val init_61: bool *) let rec dy_v_46 = (~-.)(g) and lasty_v_47 = (if init_61 then 0.000000 else (if d_1 then result_55 else iny_v_44)) and z_14 = z_49 and total match z_14 with | true -> (* dv = {y_v_13, goagain_30} *) do y_v_13 = ( *. )((~-.)(loose), lasty_v_47) and goagain_30 = true done | _ -> (* dv = {y_v_13} *) do y_v_13 = lasty_v_47 done and outy_v_45 = (if d_1 then y_v_13 else dy_v_46) and dy_41 = y_v_13 and lasty_42 = (if init_61 then y_0_2 else (if d_1 then result_56 else iny_39)) and y_12 = lasty_42 and outy_40 = (if d_1 then y_12 else dy_41) and upz_50 = (~-.)(y_12) and result_55 = pre y_v_13 and result_56 = pre lasty_42 and init_61 = true fby false in (upz_50, (outy_v_45, outy_40), (goagain_30, ((y_12, y_v_13, z_14), infinity))) let node showtime(()) = (* defs: mem(cur) t_15: float, val result_57: unit, val result_58: float, val copy_65: float *) let rec t_15 = (+.)(result_58, 0.010000) and result_57 = Showball.showtime(t_15) and copy_65 = t_15 and result_58 = 0.000000 fby copy_65 in result_57 let node main(z_51, lx_53, d_1, time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false, val upz_52: float = 1.000000, val nx_54: float * float, val result_59: float, val last_66: float, val init_67: bool, val copy_73: float *) let rec last_66 = (if init_67 then 0.000000 else copy_73) and p_28 = Zlsolve.time_geq(time_25, last_66) and total match p_28 with | true -> local pre_71, init_70, result_60, p_27 in (* dv = {next_t_29, goagain_32} *) (* defs: val p_27: float, val result_60: float, val init_70: bool, val pre_71: float *) do result_60 = (if init_70 then time_25 else last_66) and p_27 = (if init_70 then 0.010000 else pre_71) and next_t_29 = (+.)(result_60, p_27) and pre_71 = pre p_27 and goagain_32 = true and init_70 = true fby false done | _ -> (* dv = {next_t_29} *) do next_t_29 = last_66 done and (upz_52, nx_54, (goagain_34, ((y_16, y_v_17, z_18), time_26))) = ball(z_51, lx_53, d_1, time_25, y_0) and result_59 = min(time_26, next_t_29) and total match z_18 with | true -> local result_21 in (* dv = {goagain_33, xv_37, xp_38} *) (* defs: val result_21: unit *) do result_21 = Showball.show(y_16, y_v_17) and xv_37 = result_21 and xp_38 = true and goagain_33 = true done | _ -> do done and result_20 = (xv_37, xp_38) and result_22 = (if init_67 then false else p_28) and total match result_22 with | true -> local result_23 in (* dv = {goagain_31, xv_35, xp_36} *) (* defs: val result_23: unit *) do result_23 = showtime(()) and xv_35 = result_23 and xp_36 = true and goagain_31 = true done | _ -> do done and result_19 = (xv_35, xp_36) and copy_73 = pre next_t_29 and init_67 = true fby false in (upz_52, nx_54, ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), result_59))) ---------------------------------------------------------------------------- Removing of copy variables done. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let node ball(z_49, (iny_v_44, iny_39), d_1, time_24, y_0_2) = (* defs: mem(cur) y_12: float, mem(cur) y_v_13: float, mem(cur) z_14: zero, val goagain_30: bool = false, val dy_41: float = 0.000000, mem(cur) lasty_42: float, val dy_v_46: float = 0.000000, mem(cur) lasty_v_47: float, val upz_50: float = 1.000000, val result_55: float, val result_56: float, val init_61: bool *) let rec dy_v_46 = (~-.)(g) and lasty_v_47 = (if init_61 then 0.000000 else (if d_1 then result_55 else iny_v_44)) and z_14 = z_49 and total match z_49 with | true -> (* dv = {y_v_13, goagain_30} *) do y_v_13 = ( *. )((~-.)(loose), lasty_v_47) and goagain_30 = true done | _ -> (* dv = {y_v_13} *) do y_v_13 = lasty_v_47 done and outy_v_45 = (if d_1 then y_v_13 else dy_v_46) and dy_41 = y_v_13 and lasty_42 = (if init_61 then y_0_2 else (if d_1 then result_56 else iny_39)) and y_12 = lasty_42 and outy_40 = (if d_1 then lasty_42 else y_v_13) and upz_50 = (~-.)(lasty_42) and result_55 = pre y_v_13 and result_56 = pre lasty_42 and init_61 = true fby false in (upz_50, (outy_v_45, outy_40), (goagain_30, ((lasty_42, y_v_13, z_49), infinity))) let node showtime(()) = (* defs: mem(cur) t_15: float, val result_57: unit, val result_58: float, val copy_65: float *) let rec t_15 = (+.)(result_58, 0.010000) and result_57 = Showball.showtime(t_15) and copy_65 = t_15 and result_58 = 0.000000 fby t_15 in result_57 let node main(z_51, lx_53, d_1, time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false, val upz_52: float = 1.000000, val nx_54: float * float, val result_59: float, val last_66: float, val init_67: bool, val copy_73: float *) let rec last_66 = (if init_67 then 0.000000 else copy_73) and p_28 = Zlsolve.time_geq(time_25, last_66) and total match p_28 with | true -> local pre_71, init_70, result_60, p_27 in (* dv = {next_t_29, goagain_32} *) (* defs: val p_27: float, val result_60: float, val init_70: bool, val pre_71: float *) do result_60 = (if init_70 then time_25 else last_66) and p_27 = (if init_70 then 0.010000 else pre_71) and next_t_29 = (+.)(result_60, p_27) and pre_71 = pre p_27 and goagain_32 = true and init_70 = true fby false done | _ -> (* dv = {next_t_29} *) do next_t_29 = last_66 done and (upz_52, nx_54, (goagain_34, ((y_16, y_v_17, z_18), time_26))) = ball(z_51, lx_53, d_1, time_25, y_0) and result_59 = min(time_26, next_t_29) and total match z_18 with | true -> local result_21 in (* dv = {goagain_33, xv_37, xp_38} *) (* defs: val result_21: unit *) do result_21 = Showball.show(y_16, y_v_17) and xv_37 = result_21 and xp_38 = true and goagain_33 = true done | _ -> do done and result_20 = (xv_37, xp_38) and result_22 = (if init_67 then false else p_28) and total match result_22 with | true -> local result_23 in (* dv = {goagain_31, xv_35, xp_36} *) (* defs: val result_23: unit *) do result_23 = showtime(()) and xv_35 = result_23 and xp_36 = true and goagain_31 = true done | _ -> do done and result_19 = (xv_35, xp_36) and copy_73 = pre next_t_29 and init_67 = true fby false in (upz_52, nx_54, ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), result_59))) ---------------------------------------------------------------------------- Deadcode removal. See below: ---------------------------------------------------------------------------- let y_0 = 10.000000 let g = 9.810000 let loose = 0.500000 let node ball(z_49, (iny_v_44, iny_39), d_1, time_24, y_0_2) = (* defs: mem(cur) y_v_13: float, val goagain_30: bool = false, mem(cur) lasty_42: float, val dy_v_46: float = 0.000000, mem(cur) lasty_v_47: float, val upz_50: float = 1.000000, val result_55: float, val result_56: float, val init_61: bool *) let rec dy_v_46 = (~-.)(g) and lasty_v_47 = (if init_61 then 0.000000 else (if d_1 then result_55 else iny_v_44)) and total match z_49 with | true -> (* dv = {y_v_13, goagain_30} *) do y_v_13 = ( *. )((~-.)(loose), lasty_v_47) and goagain_30 = true done | _ -> (* dv = {y_v_13} *) do y_v_13 = lasty_v_47 done and outy_v_45 = (if d_1 then y_v_13 else dy_v_46) and lasty_42 = (if init_61 then y_0_2 else (if d_1 then result_56 else iny_39)) and outy_40 = (if d_1 then lasty_42 else y_v_13) and upz_50 = (~-.)(lasty_42) and result_55 = pre y_v_13 and result_56 = pre lasty_42 and init_61 = true fby false in (upz_50, (outy_v_45, outy_40), (goagain_30, ((lasty_42, y_v_13, z_49), infinity))) let node showtime(()) = (* defs: mem(cur) t_15: float, val result_57: unit, val result_58: float *) let rec t_15 = (+.)(result_58, 0.010000) and result_57 = Showball.showtime(t_15) and result_58 = 0.000000 fby t_15 in result_57 let node main(z_51, lx_53, d_1, time_25, ()) = (* defs: mem(cur) y_16: float, mem(cur) y_v_17: float, mem(cur) z_18: zero, val result_22: zero, val time_26: float, val p_28: bool, init mem(last)(cur) next_t_29: float, val goagain_31: bool = false, val goagain_32: bool = false, val goagain_33: bool = false, val goagain_34: bool = false, val xv_35: unit, val xp_36: bool = false, val xv_37: unit, val xp_38: bool = false, val upz_52: float = 1.000000, val nx_54: float * float, val result_59: float, val last_66: float, val init_67: bool, val copy_73: float *) let rec last_66 = (if init_67 then 0.000000 else copy_73) and p_28 = Zlsolve.time_geq(time_25, last_66) and total match p_28 with | true -> local pre_71, init_70, result_60, p_27 in (* dv = {next_t_29, goagain_32} *) (* defs: val p_27: float, val result_60: float, val init_70: bool, val pre_71: float *) do result_60 = (if init_70 then time_25 else last_66) and p_27 = (if init_70 then 0.010000 else pre_71) and next_t_29 = (+.)(result_60, p_27) and pre_71 = pre p_27 and goagain_32 = true and init_70 = true fby false done | _ -> (* dv = {next_t_29} *) do next_t_29 = last_66 done and (upz_52, nx_54, (goagain_34, ((y_16, y_v_17, z_18), time_26))) = ball(z_51, lx_53, d_1, time_25, y_0) and result_59 = min(time_26, next_t_29) and total match z_18 with | true -> local result_21 in (* dv = {goagain_33, xv_37, xp_38} *) (* defs: val result_21: unit *) do result_21 = Showball.show(y_16, y_v_17) and xv_37 = result_21 and xp_38 = true and goagain_33 = true done | _ -> do done and result_20 = (xv_37, xp_38) and result_22 = (if init_67 then false else p_28) and total match result_22 with | true -> local result_23 in (* dv = {goagain_31, xv_35, xp_36} *) (* defs: val result_23: unit *) do result_23 = showtime(()) and xv_35 = result_23 and xp_36 = true and goagain_31 = true done | _ -> do done and result_19 = (xv_35, xp_36) and copy_73 = pre next_t_29 and init_67 = true fby false in (upz_52, nx_54, ((or)((or)((or)(goagain_34, goagain_33), goagain_32), goagain_31), (result_20;result_19;(), result_59))) ---------------------------------------------------------------------------- Translation done. See below: ---------------------------------------------------------------------------- (* The ZĂ©lus Hybrid Synchronous language compiler, version 0.6 (Fri Jul 5 15:24:12 CEST 2013) *) let y_0 = 10. let g = 9.81 let loose = 0.5 let ball = machine { memories result_55 : float = 0. result_56 : float = 0. init_61 : bool = true instances step z_49 (iny_v_44, iny_39) d_1 time_24 y_0_2 = var goagain_30: bool = false in var y_v_13: float = 0. in let dy_v_46 = (~-.) g in let lasty_v_47 = if init_61 then 0. else if d_1 then result_55 else iny_v_44 in (if z_49 then (y_v_13 := ( *. ) ((~-.) loose) lasty_v_47; goagain_30 := true; ()) else (y_v_13 := lasty_v_47; ())); let outy_v_45 = if d_1 then !y_v_13 else dy_v_46 in let lasty_42 = if init_61 then y_0_2 else if d_1 then result_56 else iny_39 in let outy_40 = if d_1 then lasty_42 else !y_v_13 in let upz_50 = (~-.) lasty_42 in result_55 <- !y_v_13; result_56 <- lasty_42; init_61 <- false; (upz_50, (outy_v_45, outy_40), (!goagain_30, ((lasty_42, !y_v_13, z_49), infinity))) reset() = init_61 <- true; ()} let showtime = machine { memories result_58 : float = 0. instances step () = let t_15 = (+.) result_58 0.01 in let result_57 = Showball.showtime t_15 in result_58 <- t_15; result_57 reset() = result_58 <- 0.; ()} let main = machine { memories pre_71 : float = 0. init_70 : bool = true copy_73 : float = 0. init_67 : bool = true instances inst_76 : ball inst_77 : showtime step z_51 lx_53 d_1 time_25 () = var xp_38: bool = false in var xv_37: unit = () in var xp_36: bool = false in var xv_35: unit = () in var goagain_33: bool = false in var goagain_32: bool = false in var goagain_31: bool = false in var next_t_29: float = 0. in let last_66 = if init_67 then 0. else copy_73 in let p_28 = Zlsolve.time_geq time_25 last_66 in (if p_28 then let result_60 = if init_70 then time_25 else last_66 in let p_27 = if init_70 then 0.01 else pre_71 in next_t_29 := (+.) result_60 p_27; pre_71 <- p_27; goagain_32 := true; init_70 <- false; () else (next_t_29 := last_66; ())); let (upz_52, nx_54, (goagain_34, ((y_16, y_v_17, z_18), time_26))) = inst_76.step z_51 lx_53 d_1 time_25 y_0 in let result_59 = min time_26 !next_t_29 in (if z_18 then let result_21 = Showball.show y_16 y_v_17 in xv_37 := result_21; xp_38 := true; goagain_33 := true; () else ()); let result_20 = (!xv_37, !xp_38) in let result_22 = if init_67 then false else p_28 in (if result_22 then let result_23 = inst_77.step () in xv_35 := result_23; xp_36 := true; goagain_31 := true; () else ()); let result_19 = (!xv_35, !xp_36) in copy_73 <- !next_t_29; init_67 <- false; (upz_52, nx_54, ((or) ((or) ((or) goagain_34 !goagain_33) !goagain_32) !goagain_31, ((result_20; result_19; ()), result_59))) reset() = init_70 <- true; inst_76.reset(); inst_77.reset(); init_67 <- true; ()} mv main.ml ball_main.ml ocamlc -annot -c -I ../../lib ball.ml ocamlc -annot -c -I ../../lib -I '/home/romgerale/zelus-0.6.Linux-x86_64/sundialsml' ball_main.ml ocamlc -annot -o ball.byte \ -I ../../lib bigarray.cma unix.cma -I '/home/romgerale/zelus-0.6.Linux-x86_64/sundialsml' sundials_cvode.cma graphics.cma zllib.cma showball.cmo ball.cmo ball_main.cmo